package com.waypolice.manager.service.impl;


import com.waypolice.base.BaseServiceImpl;
import com.waypolice.manager.service.UpmsArchivesTypesService;
import com.waypolice.mapper.UpmsArchivesTypesMapper;
import com.waypolice.pojo.UpmsArchivesTypes;
import com.waypolice.pojo.UpmsArchivesTypesExample;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.util.List;

/**
* UpmsArchivesTypesService实现
* Created by lzh on 2019/3/12
*/
@Service
public class UpmsArchivesTypesServiceImpl extends BaseServiceImpl<UpmsArchivesTypesMapper, UpmsArchivesTypes, UpmsArchivesTypesExample> implements UpmsArchivesTypesService{

    private static final Logger LOGGER = LoggerFactory.getLogger(UpmsArchivesTypesServiceImpl.class);

    @Autowired
    UpmsArchivesTypesMapper upmsArchivesTypesMapper;

    @Override
    public List<UpmsArchivesTypes> selectByArchivesId(Integer archivesId) {
        List<UpmsArchivesTypes> upmsArchivesTypes = upmsArchivesTypesMapper.selectByArchivesId(archivesId);
        return upmsArchivesTypes;
    }

    @Override
    public List<UpmsArchivesTypes> findAllTypes() {
        UpmsArchivesTypesExample example = new UpmsArchivesTypesExample();
        example.setOrderByClause("SORT_NUM  ASC");
        UpmsArchivesTypesExample.Criteria criteria = example.createCriteria();
        criteria.andFondsIdEqualTo(1);
        List<UpmsArchivesTypes> allTypes = upmsArchivesTypesMapper.selectByExample(example);
        return allTypes;
    }

    @Override
    public List<UpmsArchivesTypes> findArchiveTypeByArchiveNum(String volClass) {
        UpmsArchivesTypesExample example = new UpmsArchivesTypesExample();
        UpmsArchivesTypesExample.Criteria criteria = example.createCriteria();
        criteria.andSortNumEqualTo(volClass);
        List<UpmsArchivesTypes> types = upmsArchivesTypesMapper.selectByExample(example);
        return types;
    }

    @Override
    public List<UpmsArchivesTypes> findTypesBySortNum(String sortNum) {
        UpmsArchivesTypesExample example = new UpmsArchivesTypesExample();
        UpmsArchivesTypesExample.Criteria criteria = example.createCriteria();
        criteria.andFondsIdEqualTo(1);
        criteria.andSortNumEqualTo(sortNum);
        List<UpmsArchivesTypes> types = upmsArchivesTypesMapper.selectByExample(example);
        return types;
    }
}